package com.ai.entity.made.page;

import com.ai.entity.made.Cameras;
import com.ai.entity.comm.page.SysBasePage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TCameraPage extends SysBasePage<Cameras> {

    @ApiModelProperty("摄像头名称	")
    private String title;

    @ApiModelProperty("摄像头IP	")
    private String cameraIp;

    @ApiModelProperty("表面（1.上表面，2.下表面）	")
    private Integer surface;

    @Override
    public QueryWrapper<Cameras> getQuery(QueryWrapper<Cameras> queryWrapper) {
        queryWrapper.orderByDesc("id");
        return queryWrapper
                .eq(surface != null && surface != 0, "surface", surface)
                .like((!StringUtils.isEmpty(title)), "title", title)
                .like((!StringUtils.isEmpty(cameraIp)), "camera_ip", cameraIp);
    }
}
